package com.xing.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xing.dto.LiveTagDTO;
import com.xing.entity.LiveTagEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LiveTagDao extends BaseMapper<LiveTagEntity> {


    @Select("select lt.id, lt.name, su.username\n" +
            "from live_tag lt\n" +
            "         join sys_user su on lt.creator = su.id\n" +
            "where lt.del_flag = 0\n" +
            "  and type = #{type}\n" +
            "limit #{pageStart},#{pageSize};")
    List<LiveTagDTO> selectLiveTagDtoPage(@Param("pageStart") int pageStart, @Param("pageSize") Integer pageSize, @Param("type") String type);


    @Select("select lt.id, lt.name, su.username\n" +
            "from live_tag lt\n" +
            "         join sys_user su on lt.creator = su.id\n" +
            "where lt.name like concat('%',#{name},'%')\n" +
            "  and lt.del_flag = 0\n" +
            "  and type = #{type};")
    List<LiveTagDTO> getSystemTagByName(@Param("name") String name, @Param("type") String type);
}
